package com.yanqu.road.server.manger.union.listener;

import com.yanqu.road.entity.enums.eUnionPosition;
import com.yanqu.road.entity.enums.eUnionSyncType;
import com.yanqu.road.entity.union.cross.CrossUnionInfo;
import com.yanqu.road.entity.union.cross.CrossUnionMember;
import com.yanqu.road.server.GameServer;
import com.yanqu.road.server.manger.ICrossUnionSyncListener;
import com.yanqu.road.server.manger.activity.unionwar.UnionPhaseWarMgr;

import java.util.List;

/**
 * 群英争霸
 */
public class UnionPhaseWarListener implements ICrossUnionSyncListener {

    @Override
    public void notifySync(int syncType, long playerId, CrossUnionInfo unionInfo, List<CrossUnionMember> memberList) {


        for (CrossUnionMember member : memberList) {
            if(member.getServerId() != GameServer.getInstance().getServerId()) {
                continue;
            }

            if(syncType == eUnionSyncType.QuitUnion.getValue()){
                //UnionPhaseWarMgr.quitUnion(member.getUserId(), unionInfo);
                UnionPhaseWarMgr.memberPositionChange(unionInfo, member.getUserId(), eUnionPosition.Member.getValue());
            }else if(syncType == eUnionSyncType.BeKick.getValue()){
                //UnionPhaseWarMgr.kickPlayer(unionInfo, member.getUserId());
                UnionPhaseWarMgr.memberPositionChange(unionInfo, member.getUserId(), eUnionPosition.Member.getValue());
            }else if(syncType == eUnionSyncType.JoinUnion.getValue()){
                //UnionPhaseWarMgr.unionMemberJoin(unionInfo, member.getUserId());
            }else if(syncType == eUnionSyncType.Normal.getValue()){
                UnionPhaseWarMgr.unionInfoChange(unionInfo);
            }
        }


    }
}
